<?php
	//some path routing
	DEFINE ('PROJECT_NAME' , 'band-in-a-bottle');										// project folder
	DEFINE ('BASE_ROOT' , $_SERVER['DOCUMENT_ROOT'].'/'.PROJECT_NAME.'/');		// website root
	DEFINE ('APP_ROOT' , BASE_ROOT . 'application/');							// application root
	DEFINE ('SYSTEM_ROOT' , BASE_ROOT . 'system/');								// system root
	DEFINE ('CLASSES_ROOT' , SYSTEM_ROOT . 'domain/');							// own classes root
	DEFINE ('ORM_ROOT' , SYSTEM_ROOT . 'database/');							// outletORM root
	DEFINE ('fCLASSES_ROOT' , SYSTEM_ROOT . 'fClasses/');						// flowrish classes root
	
	//base db configuration
	DEFINE ('DB_HOST' , 'localhost');											// database host
	DEFINE ('DB_NAME' , 'bandinabottle');										// database name
	DEFINE ('DB_USER' , 'root');												// database user
	DEFINE ('DB_PASS' , '');													// database password
	DEFINE ('DB_TYPE' , 'mysql');												// database password
	
	//autoload arrays: list of core classes to load into application
	//ORM CLASS array
	$databaseClasses = array(
			'folder' => ORM_ROOT, 
			'classes' =>
				array('Outlet')
	);
	
	//DOMAIN CLASS array
	$domainClasses = array(
			'folder' => CLASSES_ROOT,
			'classes' => 
				array(
					'Content' , 
					'Event' , 
					'Media' , 
					'User'
				)
	); 
	//FLOURISH CLASS array
	$fClasses = array(
			'folder' => fCLASSES_ROOT,
			'classes' =>
				array()
	);
	
	
	/**
	 * __AUTOLOAD
	 * @param array(root, array(systemClasses))
	 */
	function __autoload($systemClasses)
	{
		$folder = $systemClasses['folder'];
		foreach($systemClasses['classes'] as $className){
			$file = $folder . $className . '.php';
		    if (file_exists($file)) {
	    	    require $file;
		    }
		    else{
			    throw new Exception('The class ' . $className . ' could not be loaded');
		    }
		}
	}
	
	__autoload($databaseClasses);
	__autoload($domainClasses);
	__autoload($fClasses);